package cn.com.huzo.repository.tech.impl;

import cn.com.huzo.model.entities.tech.CostForecastLinesPictureEntity;
import cn.com.huzo.repository.tech.CostForecastLinesPictureRepository;
import huzofw.repository.impl.GenericRepositoryImpl;
import huzofw.repository.impl.MyBatisDaoUtils;
import java.util.List;
import org.springframework.stereotype.Repository;

/**
 * 成本预测图片数据访问对象。
 *
 * @author 吴旭
 */
@Repository("CostForecastLinesPictureRepository")
public class CostForecastLinesPictureRepositoryImpl extends GenericRepositoryImpl<CostForecastLinesPictureEntity, String>
        implements CostForecastLinesPictureRepository {

    private final String namespace = "cn.com.huzo.repository.tech.CostForecastLinesPictureRepository";

    /**
     * 构造函数,设置the entity to MaterialRepositoryImpl.class.
     */
    public CostForecastLinesPictureRepositoryImpl() {
        super(CostForecastLinesPictureEntity.class);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List<CostForecastLinesPictureEntity> fetchAll(Long headerId) {
        return getSqlSession().selectList(MyBatisDaoUtils.getMapperQueryId(
                namespace, "fetchAll"), headerId);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String insert(CostForecastLinesPictureEntity instance) {
        // 影响的行数
        getSqlSession().insert(MyBatisDaoUtils.getMapperQueryId(
                namespace, "insert"), instance);

        // 返回出入后的记录ID
        return instance.getLinesId();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer delete(String key) {
        return getSqlSession().delete(MyBatisDaoUtils.getMapperQueryId(
                namespace, "delete"), key);
    }
}
